home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu013.dms
/
pu013.adf
/
not_mine
/
BIGBOOT.S
next >
Wrap
Text File
|
2000-01-01
|
11KB
|
624 lines
ExecBase: EQU 4
AllocSignal: EQU -$14a
FindTask: EQU -$126
FreeSignal: EQU -$150
AllocMem: EQU -$c6
FreeMem: EQU -$d2
AddPort: EQU -$162
RemPort: EQU -$168
OpenDevice: EQU -$1bc
CloseDevice: EQU -$1c2
DoIO: EQU -$1c8
WaitIO: EQU -$1d8
Alert: EQU -$6c
CloseLibrary: EQU -$19e
OpenLibrary: EQU -$228
Open: EQU -$1e
Close: EQU -$24
Read: EQU -$2a
Write: EQU -$30
Input: EQU -$36
Output: EQU -$3c
Lock: EQU -$54
Examine: EQU -$66
FIBSize: EQU 300
FileSize: EQU 124
CMD_Reset: EQU 1
CMD_Read: EQU 2
CMD_Write: EQU 3
CMD_UpDate: EQU 4
CMD_Clear: EQU 5
CMD_Stop: EQU 6
CMD_Start: EQU 7
CMD_Flush: EQU 8
TD_Motor: EQU 9
TD_Seek: EQU 10
TD_Format: EQU 11
TD_Remove: EQU 12
TD_ChangeNum: EQU 13
TD_ChangeState: EQU 14
TD_ProtStatus: EQU 15
io_Command: EQU 28
io_Error: EQU 30
io_Actual: EQU 32
io_Lenght: EQU 36
io_Data: EQU 40
io_Offset: EQU 44
BlockLongPos: EQU $b8
start:
move.l ExecBase,a6
move.l #DosName,a1
clr.l d0
jsr OpenLibrary(a6)
move.l d0,DosBase
beq NoDos
move.l #Welcome,a0
bsr print
move.l #Quest1,a0
bsr print
move.l BootName,a0
bsr print
move.l #Quest2,a0
bsr print
bsr GetChars
move.b #0,-1(a0,d0) ;return loeschen
cmp.w #1,d0
bne default
move.l BootName,a0
default:
move.l #1024,d1 ;minimalgr. wg. checksum
bsr GetFile
move.l d0,FileOrt
move.l d1,FileLenght
beq NoFile
add.w #511,d1
lsr.l #8,d1
lsr.l #1,d1
sub.w #2,d1
cmp.w #0,d1
bgt ok
move.w #0,d1
ok:
move.w d1,FileSects
move.l #Quest3,a0
bsr print
bsr GetChars
move.l #0,d0
bsr GetTrackDisk
move.l ExecBase,a6
move.l #$0800,d0
move.l #$10002,d1
jsr AllocMem(a6)
move.l d0,TDBuffer
bne goon1
move.l #NoTDMem,a0
bsr print
bra cleanup3
goon1:
bsr MotorOn
move.l TDBuffer,a0
move.l #1024,d0
move.l DiskRequest,a1
move.l #880,d1
bsr DRead
move.l TDBuffer,a0
add.l #$13C,a0
move.l (a0),d1
move.l d1,BitMapSektor
add.l #$2C4,a0
move.l DiskRequest,a1
move.l #$400,d0
bsr DRead
move.l TDBuffer,a0
add.l #$400,a0
move.l 4(a0),d0
move.w #0,d1
clr.l d2
move.l #2,d3
move.l #3,d4
move.w FileSects,d5
secloop:
btst d1,d0
beq nomore
cmp.w d5,d2
bhs hab_genug
bclr d1,d0
bset d3,d4
hab_genug:
add.l #1,d2
nomore:
addi.w #1,d1
addi.w #1,d3
cmp.w #20,d1
blt secloop
move.l d0,4(a0)
move.w d2,Tracksects
move.l d4,BlockLong
move.l #MengeMsg,a0
bsr print
clr.l d0
move.w Tracksects,d0
bsr ItoA
bsr print
move.l #Menge2Msg,a0
bsr print
move.w TrackSects,d2
cmp.w Filesects,d2
bhi goon2
move.l #StillUsed,a0
bsr print
bra Cleanup4
goon2:
move.l FileOrt,a0
move.l BlockLong,d4
move.l d4,BlockLongPos(a0)
bsr BootblockChecksum
move.l #$200,d0
move.l #$0,d1
clr.l d3
wrloop:
bclr d3,d4
beq dontwrite
bsr DWrite
bne cleanup4
add.l #$200,a0
dontwrite:
add.w #1,d3
add.l #$200,d1
tst.l d4
bne wrloop
jsr DUpDate
move.l TDBuffer,a0
add.l #$400,a0
bsr BitMapChecksum
move.l BitMapSektor,d1
move.l #512,d0
lsl.l #8,d1
lsl.l #1,d1
bsr DWrite
bne cleanup4
bsr DUpDate
move.l #GoodInstall,a0
bsr print
cleanup4:
bsr MotorOff
cleanup3:
move.l ExecBase,a6
move.l TDBuffer,a1
move.l #$0800,d0
jsr FreeMem(a6)
move.l ExecBase,a6
move.l FileOrt,a1
move.l FileLenght,d0
jsr FreeMem(a6)
move.l DiskRequest,a1
bsr CloseTrackDisk
NoFile:
move.l ExecBase,a6
move.l DosBase,a1
jsr CloseLibrary(a6)
NoDos:
move.l oldcheck,d0
move.l newcheck,a0
;ILLEGAL
clr.l d0
rts
FileOrt: dc.l 0
FileLenght: dc.l 0
FileSects: dc.w 0
TrackSects: dc.w 0
BitMapSektor: dc.l 0
TDBuffer: dc.l 0
BlockLong: dc.l 0
BootName: dc.l bn
bn: dc.b "df0:boottrack",0
even
BootblockChecksum:
movem.l d0-d3/a0-a1,-(a7)
clr.l d0
clr.l d2
clr.l d3
move.l #$FF,d1
move.l a0,a1
clr.l $4(a0)
move.w #$4,CCR
bo_Checkloop:
move.l (a0)+,d2
addx.l d2,d0
dbra d1,bo_Checkloop
move.l #-1,d1
subx.l d0,d1
move.l d1,$4(a1)
move.l d1,test
movem.l (a7)+,d0-d3/a0-a1
rts
BitMapChecksum:
movem.l d0-d3/a0-a1,-(a7)
clr.l d0
clr.l d2
clr.l d3
move.l a0,a1
move.l (a0),oldcheck
clr.l (a0)
move.w #$7F,d1
bm_Checkloop:
move.l (a0)+,d2
sub.l d2,d0
dbra d1,bm_Checkloop
move.l d0,(a1)
move.l d0,newcheck
movem.l (a7)+,d0-d3/a0-a1
rts
ItoA:
move.l #ASCII_Zahl+6,a0
move.l #0,-4(a0)
move.w #0,-6(a0)
w_loopi:
divu #10,d0
swap d0
addi.w #"0",d0
move.b d0,-(a0)
clr.w d0
swap d0
cmp.w #0,d0
bne w_loopi
rts
even
ASCII_zahl: blk.b 7,0
even
MotorOn:
move.l DiskRequest,a1
move.w #TD_Motor,io_Command(a1)
move.l #1,io_Lenght(a1)
move.l ExecBase,a6
jsr DoIO(a6)
rts
MotorOff:
move.l DiskRequest,a1
move.w #TD_Motor,io_Command(a1)
move.l #0,io_Lenght(a1)
move.l ExecBase,a6
jsr DoIO(a6)
rts
DCheckWP:
movem.l d0-d7/a0-a6,-(a7)
move.l DiskRequest,a1
move.w #TD_Protstatus,io_Command(a1)
move.l ExecBase,a6
jsr DoIO(a6)
move.l DiskRequest,a1
move.l io_Actual(a1),d0
movem.l (a7)+,d0-d7/a0-a6
rts
DRead:
lsl.l #8,d1
lsl.l #1,d1
move.w #CMD_Read,io_Command(a1)
move.l d1,io_Offset(a1)
move.l a0,io_Data(a1)
move.l d0,io_Lenght(a1)
move.l ExecBase,a6
jsr DoIO(a6)
rts
even
DWrite:
movem.l d0-d7/a0-a6,-(a7)
bsr DCheckWP
beq NotProtected
move.l #WPon,a0
bsr print
move.b #1,d0
bra EndofWrite
NotProtected:
move.l DiskRequest,a1
move.l d1,io_Offset(a1)
move.w #CMD_Write,io_Command(a1)
move.l d0,io_Lenght(a1)
move.l a0,io_Data(a1)
move.l ExecBase,a6
jsr DoIO(a6)
move.b #0,d0
EndofWrite:
movem.l (a7)+,d0-d7/a0-a6
rts
DUpDate:
movem.l d0-d7/a0-a6,-(a7)
move.l DiskRequest,a1
move.w #CMD_UpDate,io_Command(a1)
move.l ExecBase,a6
jsr DoIO(a6)
movem.l (a7)+,d0-d7/a0-a6
rts
GetTrackDisk:
move.l d0,Unit
move.l #0,a0
move.b #0,d0
bsr CreatePort
move.l a0,DiskPort
beq gt_fail1
move.l #56,d0
bsr CreateExtIO
move.l a0,DiskRequest
beq gt_fail2
move.l ExecBase,a6
move.l #DiskName,a0
move.l Unit,d0
move.l DiskRequest,a1
move.l #0,d1
jsr OpenDevice(a6)
tst.l d0
bne gt_fail3
move.l DiskRequest,a1
rts
gt_fail1:
move.l #0,a1
rts
CloseTrackDisk:
move.l a1,DiskRequest
move.l ExecBase,a6
move.l DiskRequest,a1
jsr CloseDevice(a6)
gt_fail2:
move.l DiskRequest,a0
bsr DeleteExtIO
gt_fail3:
move.l DiskPort,a0
bsr DeletePort
move.l #0,a1
rts
Unit: DC.L 0
DiskPort: DC.L 0
DiskRequest: DC.L 0
DiskName: DC.B "trackdisk.device",0
even
even
CreatePort:
move.l a0,Name
move.b d0,Prio
move.l ExecBase,a6
move.b #-1,d0
jsr AllocSignal(a6)
move.b d0,sigBit
bmi.l NoSignal
move.l ExecBase,a6
move.l #$10002,d1
move.l #34,d0
jsr AllocMem(a6)
move.l d0,port
beq NoMemory
move.l d0,a0
move.l Name,10(a0)
move.b Prio,9(a0)
move.b #4,8(a0)
move.b #0,14(a0)
move.b sigBit,15(a0)
move.l ExecBase,a6
move.l #0,a1
jsr FindTask(a6)
move.l d0,16(a0)
cmpi.l #0,Name
beq doNewList
move.l ExecBase,a6
move.l port,a1
jsr AddPort(a6)
bra.s rts
doNewList:
lea 20(a0),a0
bsr NewList
rts:
move.l port,a0
rts
NoSignal:
clr.l port
bra.s rts
NoMemory:
move.l ExecBase,a6
clr.l d0
move.b sigBit,d0
jsr FreeSignal(a6)
bra.s NoSignal
even
port: dc.l 0
sigBit: dc.b 0
Prio: dc.b 0
Name: dc.l 0
DeletePort:
cmpi.l #0,10(a0)
beq NoRemPort
move.l a0,-(a7)
move.l ExecBase,a6
move.l a0,a1
jsr RemPort(a6)
move.l (a7)+,a0
NoRemPort:
move.b #$ff,8(a0)
move.l #-1,20(a0)
move.l a0,-(a7)
move.l ExecBase,a6
clr.l d0
move.b 15(a0),d0
jsr FreeSignal(a6)
move.l ExecBase,a6
move.l (a7)+,a1
move.l #34,d0
jsr FreeMem(a6)
rts
LH_Tail: EQU 4
LH_TailPred: EQU 8
NewList:
move.l a0,(a0)
addq.l #LH_Tail,(a0)
clr.l LH_Tail(a0)
move.l a0,LH_TailPred(a0)
rts
CreateExtIO:
cmpi.l #0,a0
beq NoReplyPort
move.w d0,Size
move.l a0,ReplyPort
move.l ExecBase,a6
move.l #$10002,d1
jsr AllocMem(a6)
move.l d0,a0
beq NoMemory2
move.b #5,8(a0)
move.w Size,18(a0)
move.l ReplyPort,14(a0)
rts
NoReplyPort:
NoMemory2:
move.l #0,a0
rts
Size: dc.w 0
ReplyPort: dc.l 0
DeleteExtIO:
cmpi.l #0,a0
beq rts2
move.b #$ff,8(a0)
move.l #-1,20(a0)
move.l #-1,24(a0)
move.l ExecBase,a6
move.w 18(a0),d0
move.l a0,a1
jsr FreeMem(a6)
rts2:
rts
CreateStdIO:
move.l #32,d0
bsr CreateExtIO
rts
DeleteStdIO:
bsr DeleteExtIO
rts
align 4
GetFile:
move.l a0,FileName
move.l d1,BufferSize
move.l DosBase,a6
move.l FileName,d1
move.l #1005,d2
jsr Lock(a6)
move.l d0,FileLock
beq rts
move.l ExecBase,a6
move.l #FIBSize,d0
move.l #$10002,d1
jsr AllocMem(a6)
move.l d0,FileInfoBlock
beq arts
move.l DosBase,a6
move.l FileLock,d1
move.l FileInfoBlock,d2
jsr Examine(a6)
cmpi.w #0,d0
beq FreeFIB
move.l FileInfoBlock,a0
move.l FileSize(a0),d0
addi.l #16,d0
cmp.l BufferSize,d0
blt gross_genug
move.l d0,BufferSize
gross_genug:
move.l ExecBase,a6
move.l BufferSize,d0
move.l #$10002,d1
jsr AllocMem(a6)
move.l d0,Buffer
beq FreeFIB
move.l DosBase,a6
move.l FileName,d1
move.l #1005,d2
jsr Open(a6)
move.l d0,Handle
beq FreeBuf
move.l DosBase,a6
move.l Handle,d1
move.l Buffer,d2
move.l BufferSize,d3
jsr Read(a6)
cmpi.w #0,d0
beq FreeBuf
CloseIt:
move.l DosBase,a6
move.l Handle,d1
jsr Close(a6)
FreeFIB:
move.l ExecBase,a6
move.l #FIBSize,d0
move.l FileInfoBlock,a1
jsr FreeMem(a6)
move.l Buffer,d0
arts:
move.l BufferSize,d1
rts
FreeBuf:
move.l ExecBase,a6
move.l BufferSize,d0
move.l Buffer,a1
jsr FreeMem(a6)
move.l #0,Buffer
bra CloseIt
Handle: dc.l 0
FileLock: dc.l 0
FileInfoBlock: dc.l 0
Buffer: dc.l 0
BufferSize: dc.l 0
DosBase: dc.l 0
FileName: dc.l 0
DosName: dc.b 'dos.library',0
even
print:
move.l a0,-(a7)
move.l DosBase,a6
jsr Output(a6)
move.l d0,d1
move.l (a7)+,a0
move.l a0,d2
andi.w #-2,d2
NullFind:
tst.b (a0)+
bne.s NullFind
move.l a0,d3
sub.l d2,d3
move.l DosBase,a6
jsr Write(a6)
rts
GetChars:
move.l DosBase,a6
jsr Input(a6)
move.l d0,d1
move.l #InBuffer,d2
move.l #80,d3
move.l DosBase,a6
jsr Read(a6)
move.l #InBuffer,a0
rts
InBuffer: blk.b 40,0
test: dc.l 0
oldcheck: dc.l 0
newcheck: dc.l 0
even
NoTDMem: dc.b "No room for trackdiskbuffer",10,0
even
StillUsed:dc.b "No room for bootblock on this disk",10,0
even
Welcome: dc.b 0 ;text followed by 0
Quest1: dc.b "Filename to install? (return =",34,0
Quest2: dc.b 34,") :",0
Quest3: dc.b "Insert disk to be installed in df0: and press"
dc.b " return",0
MengeMsg: dc.b 0 ;text followed by 0
Menge2Msg:dc.b " sectors free ",0
WPon: dc.b "disk is write-protected",10,0
GoodInstall:
dc.b "Boottrack installed.",10,0